<?php $this->import('Header') ?>
	<div style="height: 10px;"></div>
	<div class="well">
		<h3>设置底部连接</h3>
		<div class="tab-content">
			<div id="message-box"></div>
			<div  class="tab-pane active in">
				<div id="message-box"></div>
				<form method="post">
					<input type="hidden" name="type" value="<?php echo \Data\Options::TYPE_BOTTOM_MENU ?>" />
					<label>名称</label>
					<input type="text" name="name" value="" class="input-xlarge">
					<label>连接</label>
					<input type="text" name="link" value="" class="input-xlarge">
					<div class="btn-toolbar">
						<button class="btn btn-primary"><i class="icon-save"></i> 保存</button>
					</div>
				</form>
			</div>
		</div>
		<div class="tab-content">
			<table class="table">
				<tbody><tr>
					<td>Id</td>
					<td>名称</td>
					<td>连接</td>
					<td style="width: 160px;">操作</td>
				</tr>
				<?php foreach ($all as $val) {
						$data = json_decode($val['Value'], true);
					?>
					<tr>
						<td><?php echo $val['Id'] ?> </td>
						<td><?php echo $data[0] ?> </td>
						<td><?php echo $data[1] ?></td>
						<td>
							<a href="javascript:;" onclick="del(<?php echo $val['Id'] ?>)" class="btn">删除</a>
						</td>
					</tr>
				<?php } ?>
				</tbody></table>
		</div>
	</div>
<?php $this->import('Footer') ?>
<script>
	function del(id) {
		if (confirm('确定要删除吗？')) {
			$.ajax({
				url: '/Ajax/Options/Del',
				data: {id:id},
				type: 'post',
				dataType: 'json',
				success: function(data) {
					if (data.error) {
						alert(data.data);
					} else {
						window.location.reload();
					}
				}
			});
		}
	}
</script>